//
//  UserHelper.swift
//  kz
//
//  Created by Tech_001 on 14/8/2017.
//  Copyright © 2017 Tech_001. All rights reserved.
//

import Foundation

class UserHelper{
    
    static func setLoginStatus(_ status: Bool){
        UserDefaults.standard.set(status, forKey: DefaultKey.USER_LOGIN_STATUS)
        
        if status {
            // 登陆成功--通知
            NotificationCenter.default.post(name:  NSNotification.Name(rawValue: DefaultKey.USER_LOGIN_SUCCEED), object: nil)
        }else {
            // 登出--通知
            NotificationCenter.default.post(name:  NSNotification.Name(rawValue: DefaultKey.USER_LOGIN_OUT), object: nil)
        }
    }
    
    static func getLoginStatus() -> Bool{
        return UserDefaults.standard.bool(forKey: DefaultKey.USER_LOGIN_STATUS)
    }
}
